package org.springboot.base.demo.controller;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import org.springboot.base.user.does.UserDO;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author ZJL
 * @DateTime 2019年2月20日 下午3:06:35
 * 
 **/
@Controller
@RequestMapping(value="/thymeleaf")
public class ThymeleafController {
	
	@RequestMapping(value="/demo1")
	public String demo1(ModelMap map) {
		//Map<String,Object> map = new HashMap<String, Object>();
		//user list
		List<UserDO> list = new ArrayList<UserDO>();
		UserDO user = null;
		for(int i=3;i<10;i++) {
			user = new UserDO();
			user.setUserId(10002l+i);
			user.setUserName("userName1000"+i);
			user.setUserAge(1000+i);
			user.setUserBirthday(Calendar.getInstance().getTime());
			user.setUserPwd("userPwd1000"+i);
			list.add(user);
		}
		map.put("host", "http://www.baidu.com");
		map.put("user", user);
		map.put("list", list);
		return "thymeleaf/demo1";
	}

}
